Socket
Socket
Sign inDemoInstall

@anchan828/gen-graphql-relay-schema

Package Overview
Dependencies
Maintainers
1
Versions
173
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@anchan828/gen-graphql-relay-schema

Auto generation for relay type


Version published
Weekly downloads
21
increased by320%
Maintainers
1
Weekly downloads
 
Created
Source

@anchan828/gen-graphql-relay-schema

Description

Auto generation for relay type

Quick Start

import { genRelayTypes } from "@anchan828/gen-graphql-relay-schema";
import { buildASTSchema, printSchema } from "graphql";

const schema = `

type Project {
    id: ID
}

type Query {
    projects: [Project] @relay
}

`;

printSchema(buildASTSchema(genRelayTypes(schema)));
//=>  """A connection for relay"""
//    interface Connection {
//      """Identifies the total count of items in the connection."""
//      totalCount: Int
//
//      """Information to aid in pagination."""
//      pageInfo: PageInfo!
//
//      """A list of edges."""
//      edges: [Edge]
//    }
//
//    """An edge in a connection."""
//    interface Edge {
//      """A cursor for use in pagination."""
//      cursor: String
//    }
//
//    """An object with an ID."""
//    interface Node {
//      """ID of the object."""
//      id: ID!
//    }
//
//    """Information about pagination in a connection."""
//    type PageInfo {
//      """When paginating backwards, the cursor to continue."""
//      startCursor: String
//
//      """When paginating forwards, the cursor to continue."""
//      endCursor: String
//
//      """When paginating forwards, are there more items?"""
//      hasNextPage: Boolean
//
//      """When paginating backwards, are there more items?"""
//      hasPreviousPage: Boolean
//    }
//
//    type Project implements Node {
//      id: ID
//    }
//
//    """The connection type for Project"""
//    type ProjectConnection implements Connection {
//      """Identifies the total count of Project items in the connection."""
//      totalCount: Int
//
//      """A list of ProjectEdge."""
//      edges: [ProjectEdge]
//
//      """Information to aid in pagination."""
//      pageInfo: PageInfo!
//    }
//
//    """An edge in a ProjectConnection."""
//    type ProjectEdge implements Edge {
//      """The item at the end of the edge."""
//      node: Project
//
//      """A cursor for use in pagination."""
//      cursor: String
//    }
//
//    type Query {
//      projects(before: String, after: String, first: Int, last: Int): ProjectConnection
//    }

License

MIT.

FAQs

Package last updated on 16 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc